<?php
 require("include/db.php");
 require("include/head.php");
 require("include/upload.class.en.php");
?>
<?php
$sqla   = "select * from company where companyname='".$_POST["companyname"]."'";
$conn=getconnection();
$result = mysql_query($sqla, $conn);
$rows   = mysql_num_rows($result);
if   ($rows   !=   0)
{
  echo "Sorry,User name exited";
  echo "Please select an other companyname";
  echo "<a href=\"companysignup.php\">Resignup</a>";
}
else
{
	  if ($_POST["password"]!=$_POST["confirmpassword"])
	  {
	  	echo "password afdafd";
	  }
	  else
	  {
        $upload=new upload(); 
        $upload->upfile('userfile'); 
        $sql = "insert into company(companyname,password,tags,products,email,brief,logo,telephone,location,companygoals,signupdate,checkedcount)
         values('".$_POST["companyname"]."','".$_POST["password"]."','".$_POST["tags"]."','".$_POST["products"]."','".$_POST["email"]."','".$_POST["brief"]."','".$upload->upfile['filename']."','".$_POST["telephone"]."','".$_POST["location"]."','".$_POST["companygoals"]."',CURDATE(),0)"; 
        $res = mysql_query($sql, $conn);
        $err = mysql_error();
        if($err)
        { 
          echo "insert record into database".$err; 
        } 
        else
        {
        	echo "<h1>Congratulate,Create company account succesful!</h1>";
        }
	  }	  
}
mysql_close($conn);
?> 
<?php
 require("include/foot.php");
?>